package ioperations;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class AddOp implements IOperation{
    @Override
    public void work(BookList books) {
        Scanner scan = new Scanner(System.in);
        System.out.println("Add a book:");
        System.out.print("Book Name:");
        String bookname = scan.nextLine();
        System.out.print("Author:");
        String author = scan.nextLine();
        System.out.print("Max Page:");
        int page = scan.nextInt();
        Book tmp = new Book(bookname, author, page);
        books.setBook(books.getUsed_size(), tmp);
        books.setUsed_size(books.getUsed_size() + 1);
        System.out.println("Add book success: " + tmp);
    }
}
